home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicTreeUI$TreePageAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.9 KB  |  80 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Dimension;
  4. import java.awt.Rectangle;
  5. import java.awt.event.ActionEvent;
  6. import javax.swing.AbstractAction;
  7. import javax.swing.tree.TreePath;
  8.  
  9. public class BasicTreeUI$TreePageAction extends AbstractAction {
  10.    // $FF: synthetic field
  11.    private final BasicTreeUI this$0;
  12.    protected int direction;
  13.    private boolean addToSelection;
  14.    private boolean changeSelection;
  15.  
  16.    public BasicTreeUI$TreePageAction(BasicTreeUI var1, int var2, String var3) {
  17.       this(var1, var2, var3, false, true);
  18.    }
  19.  
  20.    private BasicTreeUI$TreePageAction(BasicTreeUI var1, int var2, String var3, boolean var4, boolean var5) {
  21.       this.this$0 = var1;
  22.       this.direction = var2;
  23.       this.addToSelection = var4;
  24.       this.changeSelection = var5;
  25.    }
  26.  
  27.    // $FF: synthetic method
  28.    BasicTreeUI$TreePageAction(BasicTreeUI var1, BasicTreeUI.1 var2, int var3, String var4, boolean var5, boolean var6) {
  29.       this(var1, var3, var4, var5, var6);
  30.    }
  31.  
  32.    public void actionPerformed(ActionEvent var1) {
  33.       if (this.this$0.tree != null && this.this$0.getRowCount(this.this$0.tree) > 0 && this.this$0.treeSelectionModel != null) {
  34.          Dimension var3 = this.this$0.tree.getSize();
  35.          TreePath var4 = BasicTreeUI.access$4(this.this$0);
  36.          Rectangle var6 = this.this$0.tree.getVisibleRect();
  37.          TreePath var5;
  38.          if (this.direction == -1) {
  39.             var5 = this.this$0.getClosestPathForLocation(this.this$0.tree, var6.x, var6.y);
  40.             if (var5.equals(var4)) {
  41.                var6.y = Math.max(0, var6.y - var6.height);
  42.                var5 = this.this$0.tree.getClosestPathForLocation(var6.x, var6.y);
  43.             }
  44.          } else {
  45.             var6.y = Math.min(var3.height, var6.y + var6.height - 1);
  46.             var5 = this.this$0.tree.getClosestPathForLocation(var6.x, var6.y);
  47.             if (var5.equals(var4)) {
  48.                var6.y = Math.min(var3.height, var6.y + var6.height - 1);
  49.                var5 = this.this$0.tree.getClosestPathForLocation(var6.x, var6.y);
  50.             }
  51.          }
  52.  
  53.          Rectangle var7 = this.this$0.getPathBounds(this.this$0.tree, var5);
  54.          var7.x = var6.x;
  55.          var7.width = var6.width;
  56.          if (this.direction == -1) {
  57.             var7.height = var6.height;
  58.          } else {
  59.             var7.y -= var6.height - var7.height;
  60.             var7.height = var6.height;
  61.          }
  62.  
  63.          if (this.addToSelection) {
  64.             BasicTreeUI.access$7(this.this$0, var5);
  65.          } else if (this.changeSelection) {
  66.             this.this$0.tree.setSelectionPath(var5);
  67.          } else {
  68.             BasicTreeUI.access$6(this.this$0, var5, true);
  69.          }
  70.  
  71.          this.this$0.tree.scrollRectToVisible(var7);
  72.       }
  73.  
  74.    }
  75.  
  76.    public boolean isEnabled() {
  77.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  78.    }
  79. }
  80.